

package practicabeta;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import com.mysql.jdbc.Statement;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.File;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.sound.sampled.AudioSystem;
import javax.swing.JFrame;
import javax.swing.JOptionPane;


public class LlantasCabezal extends javax.swing.JFrame {
javax.sound.sampled.Clip sonido;
   int id[]= new int[10];
   
    int resultado;
    public LlantasCabezal() {
        initComponents();
    }

    
 
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        cd = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        dd = new javax.swing.JTextField();
        di = new javax.swing.JTextField();
        mei = new javax.swing.JTextField();
        mii = new javax.swing.JTextField();
        mil = new javax.swing.JTextField();
        med = new javax.swing.JTextField();
        tei = new javax.swing.JTextField();
        tii = new javax.swing.JTextField();
        tid = new javax.swing.JTextField();
        ted = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Nuevo Paquete Llantas Cabezal ");

        cd.setBackground(new java.awt.Color(0, 0, 0));
        cd.setForeground(new java.awt.Color(255, 255, 255));
        cd.setText("Auto_Increment");
        cd.setEnabled(false);
        cd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cdActionPerformed(evt);
            }
        });

        jLabel2.setText("C o d i g o ");

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes Proy Supervisada/ImagenLlanta.png"))); // NOI18N

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes Proy Supervisada/ImagenLlanta.png"))); // NOI18N

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes Proy Supervisada/ImagenLlanta.png"))); // NOI18N

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes Proy Supervisada/ImagenLlanta.png"))); // NOI18N

        jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes Proy Supervisada/ImagenLlanta.png"))); // NOI18N

        jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes Proy Supervisada/ImagenLlanta.png"))); // NOI18N

        jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes Proy Supervisada/ImagenLlanta.png"))); // NOI18N

        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes Proy Supervisada/ImagenLlanta.png"))); // NOI18N

        jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes Proy Supervisada/ImagenLlanta.png"))); // NOI18N

        jLabel14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes Proy Supervisada/ImagenLlanta.png"))); // NOI18N

        jButton1.setText("Insertar ");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton3.setText("Cancerlar");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addGap(4, 4, 4)
                .addComponent(cd, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(59, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(70, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addGap(18, 18, 18)
                .addComponent(jButton3)
                .addGap(25, 25, 25))
            .addGroup(layout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(dd, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(tei, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(di))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(tii, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel14)))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel7))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(mei, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(mii, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel10)
                                    .addComponent(jLabel4)
                                    .addComponent(tid, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(ted, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel12)
                                    .addComponent(jLabel8)))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(mil, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(med, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(51, 51, 51))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(dd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(di, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(82, 82, 82)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(mei, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(mii, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel7))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel11)
                            .addComponent(jLabel14)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(82, 82, 82)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(mil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(med, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel6)
                            .addComponent(jLabel4))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel10)
                            .addComponent(jLabel12))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(tei, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(tii, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(tid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(ted, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1))
                .addGap(5, 5, 5))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cdActionPerformed
       
}//GEN-LAST:event_cdActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        dispose();
        PaqueteLlanta va;

    
            va = new PaqueteLlanta();
            va.setVisible(true);
            Dimension pantalla, cuadro;
            pantalla = Toolkit.getDefaultToolkit().getScreenSize();
            cuadro = va.getSize();
            va.setLocation(((pantalla.width - cuadro.width)/2),(pantalla.height - cuadro.height)/2);
            va.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     
}//GEN-LAST:event_jButton3ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
            IngresarLlantas();
           
           LlenarPacketeN();


    }//GEN-LAST:event_jButton1ActionPerformed

   public void IngresarLlantas (){

     try {
          

            resultado = 0 ;

          

            MysqlDataSource dataSource = new MysqlDataSource();
            dataSource.setUser("root");
            dataSource.setPassword("");
            dataSource.setDatabaseName("practicasp8");
            dataSource.setServerName("localhost");
          Connection  conexion = (Connection) dataSource.getConnection();

            Statement instruccion;
            ResultSet rs;
            instruccion = (Statement) conexion.createStatement();
                    int num[]= new int[10]; // arreglo de numeros

 // LLANTA UNO
            try {
                     num[0]=Integer.parseInt(di.getText());
                }catch (Exception e){
                    JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

                }
                   
            instruccion.executeUpdate("insert into di (codigo) values ('"+num[0]+"')",PreparedStatement.RETURN_GENERATED_KEYS); // me sirve para obter el id
           // Guardo el valor del id 
           rs = instruccion.getGeneratedKeys();
            while (rs.next()) {
                id[0] = rs.getInt(1);
                
                }





// LLANTA DOS
    try {
                     num[1]=Integer.parseInt(dd.getText());
                }catch (Exception e){
                    JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

                }

            instruccion.executeUpdate("insert into dd (codigo) values ('"+num[1]+"')",PreparedStatement.RETURN_GENERATED_KEYS);
  // Guardo el valor del id 
           rs = instruccion.getGeneratedKeys();
            while (rs.next()) {
                id[1] = rs.getInt(1);
                
                }



//LLANTA TRES
           
           try {
                     num[2]=Integer.parseInt(mei.getText());
                }catch (Exception e){
                    JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

                }

            instruccion.executeUpdate("insert into mei (codigo) values ('"+num[2]+"')",PreparedStatement.RETURN_GENERATED_KEYS);
  // Guardo el valor del id
           rs = instruccion.getGeneratedKeys();
            while (rs.next()) {
                id[2] = rs.getInt(1);

                }



// LLANTA CUATRO
             try {
                     num[3]=Integer.parseInt(mii.getText());
                }catch (Exception e){
                    JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

                }

            instruccion.executeUpdate("insert into mii (codigo) values ('"+num[3]+"')",PreparedStatement.RETURN_GENERATED_KEYS);
  // Guardo el valor del id
           rs = instruccion.getGeneratedKeys();
            while (rs.next()) {
                id[3] = rs.getInt(1);

                }


  //LLANTA CINCO
              try {
                     num[4]=Integer.parseInt(mil.getText());
                }catch (Exception e){
                    JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

                }

            instruccion.executeUpdate("insert into mil (codigo) values ('"+num[4]+"')",PreparedStatement.RETURN_GENERATED_KEYS);
  // Guardo el valor del id
           rs = instruccion.getGeneratedKeys();
            while (rs.next()) {
                id[4] = rs.getInt(1);

                }
//LANTA SEIS
               try {
                     num[5]=Integer.parseInt(med.getText());
                }catch (Exception e){
                    JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

                }

            instruccion.executeUpdate("insert into med (codigo) values ('"+num[5]+"')",PreparedStatement.RETURN_GENERATED_KEYS);
  // Guardo el valor del id
           rs = instruccion.getGeneratedKeys();
            while (rs.next()) {
                id[5] = rs.getInt(1);

                }

 //LLNATA SIETE
             try {
                     num[6]=Integer.parseInt(tei.getText());
                }catch (Exception e){
                    JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

                }

            instruccion.executeUpdate("insert into tei (codigo) values ('"+num[6]+"')",PreparedStatement.RETURN_GENERATED_KEYS);
  // Guardo el valor del id
           rs = instruccion.getGeneratedKeys();
            while (rs.next()) {
                id[6] = rs.getInt(1);

                }

 //LLANTA OCHO
               try {
                     num[7]=Integer.parseInt(tii.getText());
                }catch (Exception e){
                    JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");


                }

            instruccion.executeUpdate("insert into tii (codigo) values ('"+num[7]+"')",PreparedStatement.RETURN_GENERATED_KEYS);
  // Guardo el valor del id
           rs = instruccion.getGeneratedKeys();
            while (rs.next()) {
                id[7] = rs.getInt(1);

                }
//LLANTA NUEVE
                try {
                     num[8]=Integer.parseInt(tid.getText());
                }catch (Exception e){
                    JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

                }

            instruccion.executeUpdate("insert into tid (codigo) values ('"+num[8]+"')",PreparedStatement.RETURN_GENERATED_KEYS);
  // Guardo el valor del id
           rs = instruccion.getGeneratedKeys();
            while (rs.next()) {
                id[8] = rs.getInt(1);

                }
 //LLANTA DIEZ
             try {
                     num[9]=Integer.parseInt(ted.getText());
                }catch (Exception e){
                    JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

                }

            instruccion.executeUpdate("insert into ted (codigo) values ('"+num[9]+"')",PreparedStatement.RETURN_GENERATED_KEYS);
  // Guardo el valor del id
           rs = instruccion.getGeneratedKeys();
            while (rs.next()) {
                id[9] = rs.getInt(1);

                }


            // sonido


try
{
  sonido = null;
  sonido=AudioSystem.getClip();
  sonido.open(AudioSystem.getAudioInputStream(new File(System.getProperty ("user.dir")+"\\src\\SonidosPractica\\Correcto2.wav")));
  sonido.start();




}catch(Exception e)
  {System.out.println(""+e);} // fin


            JOptionPane.showMessageDialog(rootPane, "Dato ingresado exitosamente"+resultado);

               conexion.close(); // cierro la conexion
               

             }catch(SQLException e){

            System.out.println("EXCEPCION EN Base de Datos:"+e.toString());
           } // fin del catch

   }

  

   public void LlenarPacketeN (){
       {

     try {
            resultado = 0 ;

            MysqlDataSource dataSource = new MysqlDataSource();
            dataSource.setUser("root");
            dataSource.setPassword("");
            dataSource.setDatabaseName("practicasp8");
            dataSource.setServerName("localhost");
             // coneccion
            Connection conexion = (Connection) dataSource.getConnection();
            for(int k=0; k!=9;k++){
                System.out.printf("\n "+id[k]);
            }
            PreparedStatement ps = null;

            ps = (PreparedStatement) conexion.prepareStatement("insert into tipollantacabezal (di,dd,mei,mii,mil,med,tei,tii,tid,ted) values (?,?,?,?,?,?,?,?,?,?)");

            try {
                 ps.setInt(1,id[0]);
            }catch(Exception e){
                   JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

           } // fin del catch

  // LLANTA DOS
           
          

            try {
                 ps.setInt(2,id[1]);
            }catch(Exception e){
                   JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

           } // fin del catch

//LANTA TRES
         
            try {
                 ps.setInt(3,id[2]);
            }catch(Exception e){
                   JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

           } // fin del catch
 // LLANTA CUATRO
          

            try {
                 ps.setInt(4,id[3]);
            }catch(Exception e){
                   JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

           } // fin del catch
 //LLANTA CINCO
           
            try {
                 ps.setInt(5,id[4]);
            }catch(Exception e){
                   JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

           } // fin del catch
 //LANTA SEIS
          

            try {
                 ps.setInt(6,id[5]);
            }catch(Exception e){
                   JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

           } // fin del catch
   //LLNATA SIETE
           

            try {
               ps.setInt(7,id[6]);
            }catch(Exception e){
                   JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

           } // fin del catch
 //LLANTA OCHO
           

            try {
                 ps.setInt(8,id[7]);
            }catch(Exception e){
                   JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

           } // fin del catch
   //LLANTA NUEVE
           
            try {
                 ps.setInt(9,id[8]);
            }catch(Exception e){
                   JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

           } // fin del catch
  //LLANTA DIEZ
          

            try {
                 ps.setInt(10,id[9]);
            }catch(Exception e){
                   JOptionPane.showMessageDialog(rootPane, "Dato erroneo Revisar Manual  ");

           } // fin del catch

             resultado = ps.executeUpdate();
           


            JOptionPane.showMessageDialog(rootPane, "Dato ingresado exitosamente"+resultado);
           
               conexion.close(); // cierro la conexion
               ps.close();

             }catch(SQLException e){

            System.out.println("EXCEPCION EN Base de Datos:"+e.toString());
           } // fin del catch

   }

   }
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new LlantasCabezal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField cd;
    private javax.swing.JTextField dd;
    private javax.swing.JTextField di;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JTextField med;
    private javax.swing.JTextField mei;
    private javax.swing.JTextField mii;
    private javax.swing.JTextField mil;
    private javax.swing.JTextField ted;
    private javax.swing.JTextField tei;
    private javax.swing.JTextField tid;
    private javax.swing.JTextField tii;
    // End of variables declaration//GEN-END:variables

}
